import request from "./request"

//删除商品列表
const delentList = (goods_id) => request.delete(`goods/${goods_id}`)
//获取商品管理数据
const deleteAttrbutes = (id, attrId) => request.delete(`categories/${id}/attributes/${attrId}`)
//获取商品管理弹出框数据
const getCategories = (model) => request.get('categories', { params: model })
//商品管理提交
const getCategoriesAdd = (model) => request.post('/categories', model)
//商品分类修改
const updata = (msg) => {
    let data = request.put('/categories/' + msg.cat_id, { cat_name: msg.cat_name })
    return data
}
//获取分类参数下拉框的数据
const getCategoriess = (queryModel) => request.get(`categories`,{
    params:queryModel
})
//获取分类参数表格的数据
const getArrList=(id,type)=>request.get(`categories/${id}/attributes?sel=${type}`)
//获取表格里的tag的数据

const Handel=(id,attrId,model)=>request.put(`categories/${id}/attributes/${attrId}`,model)

export const updatagetadd=(id,model)=>request.put( `/categories/${id}/attributes/${model.attr_id}`,model)


// 分类参数添加
const getaddList=(msg)=>request.post(`/categories/${msg.id}/attributes`,{
    attr_name:msg.attr_name,
    attr_sel:msg.attr_sel
})
export {
    getaddList,
    Handel,
    delentList,
    deleteAttrbutes,
    getCategories,
    updata,
    getCategoriesAdd,
    getCategoriess,
    getArrList

}